package com.coolwen.service;

import com.coolwen.dao.ResourceMapper;
import com.coolwen.entity.Resource;
import com.coolwen.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by user on 2016/6/10.
 */
@Service("resourceService")
public class ResourceServiceImpl implements ResourceService {

    @Autowired
    private ResourceMapper resDao;

    @Override
    public Resource load(long resId) {
        return resDao.selectById(resId);
    }

    @Override
    public int deleteRes(long resId) {
        return resDao.deleteById(resId);
    }

    @Override
    public int updateRes(Resource resource) {
        return resDao.updateById(resource);
    }

    @Override
    public int addRes(Resource resource) {
        return resDao.insertSelective(resource);
    }

    @Override
    public List<Resource> listResource() {
        return resDao.listResource();
    }
}
